<template>
  <div>
    <div class="control-strategy-page">
      <!-- aside 
            v-if="permission.add"
            v-if="permission.modify"
            v-if="permission.delete"-->

      <!-- content v-if="permission.add_operation"     v-if="permission.delete_operation"-->
      <div class="content container">
        <div class="head-section">
          <h3 class="table-head">所属网点：</h3>
          <el-select v-model="organId" @change="organChangeEvent" placeholder="请选择所属网点">
            <el-option v-for="item in organOptions" :key="item.id" :label="item.name" :value="item.id">
            </el-option>

          </el-select>
          <span style="margin-left:10px;height: 0.43rem;line-height: 0.43rem;font-size: 0.16rem;">一键启用/停用：</span>
          <el-switch :active-value="1" :inactive-value="0" @change="changeJobByOrgan()" active-color="#13ce66"
            inactive-color="#ff4949" v-model="changeJobByOrganId" active-text="启用" inactive-text="停用"></el-switch>
            <el-tooltip class="item" effect="dark" content="组设备策略功能停用" placement="right">
      <i class="el-icon-warning-outline" style="color: #fff;font-size: 20px;margin-left: 10px;"></i>
    </el-tooltip>
          <header>
            <el-button @click="handleAddOperation" size="medium" type="primary" plain>添加
            </el-button>
            <!-- <el-button
              @click="handleDeleteOperation"
              size="medium"
              type="primary"
              plain
              >移除
            </el-button> -->
          </header>
        </div>
        <div class="table-section">
          <el-scrollbar wrap-class="scrollbar-wrapper" style="height: 100%">
            <el-table ref="refAreaAppliancesTable" :data="operationTableData" border
              @selection-change="handleOperationChange">
              <el-table-column type="selection" width="40"></el-table-column>
              <el-table-column type="index" label="序号" width="50">
              </el-table-column>
              <el-table-column prop="jobName" label="策略名" style="cursor: pointer" width="150">
              </el-table-column>
              <el-table-column prop="description" label="备注" style="cursor: pointer">
              </el-table-column>
              <el-table-column prop="weekdayStr" label="重复" style="cursor: pointer" width="350">
                <template slot-scope="scope">
                  <el-checkbox-group :min="1" v-model="scope.row.runWeekstr" @change="
                    (val) => {
                      checkboxOptions(val, scope.row);
                    }
                  ">
                    <el-checkbox v-for="item in weekOptions" :key="item.id" :label="item.id">
                      {{ item.name }}
                    </el-checkbox>
                  </el-checkbox-group>
                </template>
              </el-table-column>
              <el-table-column prop="runTime" label="时间" width="150">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.runTime" type="time" @focus="timeChange(scope.row)"
                    @blur="operationChange(scope.row, $event)" style="width: auto"></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="runTime" label="启用" width="150">
                <template slot-scope="scope">
                  <el-switch :active-value="false" :inactive-value="true" @change="operationChangeIsPause(scope.row)"
                    active-color="#13ce66" inactive-color="#ff4949" v-model="scope.row.isPause" active-text="启用"
                    inactive-text="停用"></el-switch>
                </template>
              </el-table-column>
              <el-table-column prop="onOff" label="控制" style="cursor: pointer" width="400">
                <template slot-scope="scope">
                  <el-radio-group v-model="scope.row.onOff" @change="operationChange(scope.row)">
                    <el-radio :label="1">开</el-radio>
                    <el-radio :label="0">关</el-radio>
                  </el-radio-group>
                  <div class="aic-conditioner-section">
                    <span v-if="scope.row.airTemperatureset !== '26'" class="air-table-item">
                      <span>温度：</span>
                      <!-- <el-input v-model="scope.row.temperature" @change="operationChange(scope.row)" class="tem-input"></el-input>
                                            <span class="temperature-txt">℃</span> -->
                      <el-select v-model="scope.row.airTemperatureset" size="mini" @change="operationChange(scope.row)">
                        <el-option v-for="item in temOptions()" :key="item" :label="item" :value="item">
                        </el-option>
                      </el-select>℃
                    </span>
                    <span v-if="scope.row.airMode !== 0" class="air-table-item">
                      <span>模式：</span>
                      <el-select v-model="scope.row.airMode" placeholder="请选择" size="mini"
                        @change="operationChange(scope.row)">
                        <el-option v-for="item in modeOptions" :key="item.M" :label="item.name" :value="item.M">
                        </el-option>
                      </el-select>
                    </span>
                    <span v-if="scope.row.airSpeed !== 0" class="air-table-item">
                      <span>风速：</span>
                      <el-select v-model="scope.row.airSpeed" placeholder="请选择" size="mini"
                        @change="operationChange(scope.row)">
                        <el-option v-for="item in speedOptions" :key="item.W" :label="item.name" :value="item.W">
                        </el-option>
                      </el-select>
                    </span>
                    <span v-if="scope.row.airWinddirection !== 0" class="air-table-item">
                      <span>风向：</span>
                      <el-select v-model="scope.row.airWinddirection" placeholder="请选择" size="mini"
                        @change="operationChange(scope.row)">
                        <el-option v-for="item in directionOptions" :key="item.D" :label="item.name" :value="item.D">
                        </el-option>
                      </el-select>
                    </span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column label="编辑操作" width="250">
                <template slot-scope="scope">
                  <el-button type="primary" size="small" @click="handleEditOperation(scope.row)">编辑</el-button>
                  <el-button type="primary" size="small" @click="handleDeleteOperation(scope.row)">删除</el-button>
                  <el-button type="primary" size="small" @click="handletargetBindJob(scope.row)">绑定分组</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-scrollbar>
        </div>
      </div>


      <!-- 新策略包含的操作弹框 -->
      <el-dialog class="same-dia" title="新增操作" :visible.sync="dialogOperationVisible" width="500px"
        @close="resetOperaForm" :close-on-click-modal="false">
        <el-form :rules="rules" :model="pojoOperation" ref="pojoOperaForm" label-width="100px">
          <el-form-item label="任务名称：" prop="jobName">
            <el-input v-model="pojoOperation.jobName"></el-input>
          </el-form-item>

          <el-form-item label="重复：" prop="runWeek">
            <el-checkbox-group v-model="pojoOperation.runWeek">
              <el-checkbox v-for="item in weekOptions" :key="item.id" :label="item.id">{{ item.name }}
              </el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="时间：" prop="time">
            <el-time-picker v-model="pojoOperation.runTime" value-format="HH:mm" format="HH:mm" placeholder="选择时间">
            </el-time-picker>
          </el-form-item>
          <el-form-item label="操作：" prop="remark">
            <el-radio v-model="pojoOperation.onOff" :label="1">开</el-radio>
            <el-radio v-model="pojoOperation.onOff" :label="0">关</el-radio>
          </el-form-item>
          <el-form-item label="启用：" prop="remark">
            <el-switch :active-value="0"  :inactive-value="1" active-color="#13ce66" inactive-color="#ff4949"
              v-model="pojoOperation.isPause" active-text="启用" inactive-text="停用"></el-switch>
          </el-form-item>

          <el-form-item label="备注" prop="description">
            <el-input v-model="pojoOperation.description"></el-input>
          </el-form-item>
          <div :class="{ disabled: pojoOperation.onOff == 0 }">
            <el-form-item label="空调操作：" prop="remark">
              <el-radio v-model="airOperationFlag" label="1">是</el-radio>
              <el-radio v-model="airOperationFlag" label="2">否</el-radio>
             
            </el-form-item>
             <div v-show="airOperationFlag == '1'" :class="{ disabled: airOperationFlag == '2' }">
                <el-form-item label="温度：" prop="airTemperatureset">
                  <el-button icon="el-icon-minus" @click="handleTemperatureChange('reduce')" round></el-button>
                  <span class="temperature-txt">{{ pojoOperation.airTemperatureset }}℃</span>
                  <el-button icon="el-icon-plus" @click="handleTemperatureChange('add')" round></el-button>
                </el-form-item>
                <el-form-item label="模式：" prop="airMode">
                  <el-select v-model="pojoOperation.airMode" :disabled="airOperationFlag == '2'" placeholder="请选择"
                    style="margin-bottom: 10px;">
                    <el-option v-for="item in modeOptions" :key="item.M" :label="item.name" :value="item.M">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="风速：" prop="airSpeed">
                  <el-select v-model="pojoOperation.airSpeed" :disabled="airOperationFlag == '2'" placeholder="请选择"
                    style="margin-bottom: 10px">
                    <el-option v-for="item in speedOptions" :key="item.W" :label="item.name" :value="item.W">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="风向：" prop="airWinddirection">
                  <el-select v-model="pojoOperation.airWinddirection" :disabled="airOperationFlag == '2'"
                    placeholder="请选择">
                    <el-option v-for="item in directionOptions" :key="item.D" :label="item.name" :value="item.D">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
          </div>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button v-if="isadd" type="primary" @click="addOperationSubmit('pojoOperaForm')">确 定
          </el-button>
          <el-button v-else type="primary" @click="EditOperationSubmit('pojoOperaForm')">确 定
          </el-button>
          <el-button @click="dialogOperationVisible = false">取 消</el-button>
        </div>
      </el-dialog>


      <el-dialog title="绑定任务目标" :visible.sync="targetBindJobVisible" width="600px" :close-on-click-modal="false">
        <el-transfer class="shuttle-row" :titles="['未绑定目标', '已绑定目标']" :button-texts="['移除', '添加']"
          :props="JobTargetListProps" v-model="JobTargetLis" @change="submittargetBindJob"
          :data="AllAreaAppliancesData">
        </el-transfer>
        <div style="text-align: center; margin-top: 20px">
          <el-button size="medium" @click="targetBindJobVisible = false">取 消
          </el-button>
        </div>


      </el-dialog>


    </div>
  </div>
</template>

<script>
import ajax from "@/utils/ajax";
import { tableSelection, deleteConfirm } from "@/utils/elementui.js";
import date from "@/utils/date";
import axios from "axios";
export default {
  data() {
    return {
      userid: "",
      organId: null,
      permission: {
        add: false,
        modify: false,
        delete: false,
        add_operation: false,
        delete_operation: false,
      },
      tableIndex: 0,
      isAddNew: true,
      rules: {
        jobName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
        runWeek: [
          { required: true, message: "请选择重复的类型", trigger: "blur" },
        ],
        organId: [
          { required: true, message: "请选任务所属网点", trigger: "change" },
        ],
        runTime: [{ required: true, message: "时间不能为空", trigger: "blur" }],
        airMode: [{ required: true, message: "模式不能为空", trigger: "blur" }],
        airSpeed: [
          { required: true, message: "风速能为空", trigger: "blur" },
        ],
        airWinddirection: [
          { required: true, message: "风向不能为空", trigger: "blur" },
        ],
        airTemperatureset: [
          { required: true, message: "温度不能为空", trigger: "blur" },
        ],
      },
      pojoStrategy: {
        userid: this.$store.getters.user.id,
        name: "",
        tag: "",
        remark: "",
      },
      // 操作table
      operationTableData: [],
      weekOptions: [
        { id: 1, name: "周日" },
        { id: 2, name: "周一" },
        { id: 3, name: "周二" },
        { id: 4, name: "周三" },
        { id: 5, name: "周四" },
        { id: 6, name: "周五" },
        { id: 7, name: "周六" },
      ],
      radio: "1",
      isadd:true,
      dialogOperationVisible: false,
      pojoOperation: {
        jobName: "",
        organId: null,
        runWeek: [],
        runTime: "",
        onOff: 0,
        airMode: 0,
        isPause: 1,
        beanName: 'probeTimeTask',
        airSpeed: 0,
        airWinddirection: 0,
        airTemperatureset: 26,
        description: "",
      },
      modeOptions: [
        {
          name: "自动",
          M: 0,
        },
        {
          name: "制冷",
          M: 1,
        },
        {
          name: "除湿",
          M: 2,
        },
        {
          name: "送风",
          M: 3,
        },
        {
          name: "制暖",
          M: 4,
        },
      ],
      speedOptions: [
        {
          name: "自动",
          W: 0,
        },
        {
          name: "1档",
          W: 1,
        },
        {
          name: "2档",
          W: 2,
        },
        {
          name: "3档",
          W: 3,
        },
      ],
      directionOptions: [
        {
          name: "自动",
          D: 0,
        },
        {
          name: "手动",
          D: 1,
        },
      ],
      airOperationFlag: "2",

      muloperationSelection: [],
      temOptions: function () {
        let arr = [];
        for (let i = 16; i <= 31; i++) {
          arr.push(i);
        }
        return arr;
      },
      cronPopover: "",
      triggerCron: "",
      input: "",
      expression: "",
      showCron: false,
      //网点列表
      organOptions: [],
      targetBindJobVisible: false,
      jobId: null,
      JobdefaultProps: {
        label: "name",
      },
      AreaAppliancesData: [],
      AllAreaAppliancesData: [],
      JobTargetListProps: {
        key: "id",
        label: "name",
      },
      JobTargetLis: [],
      changeJobByOrganId: null,
      OrganIdindex:0
    };
  },
  created() {
    this.userid = this.$store.getters.user.id;
    this.getOrganListData();
  },
  mounted() {
    this.$store.dispatch("actions/dynamicTitleAction", this.$route.meta.title);
  },
  methods: {

    // 设置可操作的权限
    setPermission() {
      let role_permissions = this.$store.getters.rolePermissions;
      console.log("-----------------------", role_permissions);
      for (let item of role_permissions) {
        if (item.action === "/web/strategy") {
          for (let permission of item.privilegeList) {
            switch (permission.action) {
              case "/web/strategy/add":
                this.permission.add = true;
                break;
              case "/web/strategy/modify":
                this.permission.modify = true;
                break;
              case "/web/strategy/delete":
                this.permission.delete = true;
                break;
              case "/web/strategy/add_operation":
                this.permission.add_operation = true;
                break;
              case "/web/strategy/delete_operation":
                this.permission.delete_operation = true;
                break;
              default:
                break;
            }
          }
        }
      }
    },
    // 获取网点列表
    getOrganListData() {
      ajax.get({
        url: this.$API.getUserOrgan + this.userid,
        success: (response) => {
          //console.log(response)
          const resp = response.data;
          if (resp.length > 0) {
            this.organOptions = resp;
            this.organId = resp[0].id
            this.changeJobByOrganId = resp[0].probeTask !=null?resp[0].probeTask:1
            this.getStrategyOperationData();
            this.getAreaAppliances()
          } else {
            this.organOptions = [];
          }
        },
        error: (res) => {
          //console.log(res)
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    //切换网点
    organChangeEvent() {
      let probeTask = this.organOptions.filter(data => data.id == this.organId)[0].probeTask
      this.OrganIdindex =this.organOptions.findIndex(data => data.id == this.organId)
      this.changeJobByOrganId = probeTask !=null?probeTask:1
      this.getStrategyOperationData()
      this.getAreaAppliances()
    },
    // 网点下的控制策略
    getStrategyOperationData() {
      let po_id = this.organId;
      ajax.get({
        url: this.$API.getQuartzJobByOrganId + po_id,
        success: (response) => {
          const resp = response.data;
          for (let item of resp) {
            item.runWeekstr =
              item.runWeek != ""
                ? item.runWeek.split(",").map(parseFloat)
                : [];
            item.airMode = parseInt(item.airMode)
            item.airSpeed = parseInt(item.airSpeed)
            item.airWinddirection = parseInt(item.airWinddirection)
          }
          this.operationTableData = resp;
        },
      });
    },
    checkValue(checkArr, id) {
      if (checkArr.indexOf(id) !== -1) {
        return true;
      } else {
        return false;
      }
    },

    // 修改重复（周几）
    checkboxOptions(value, checkData) {

      let po_obj = {
        id: checkData.id,
        runTime: checkData.runTime,
        onOff: checkData.onOff,
        airMode: checkData.airMode,
        airTemperatureset: checkData.airTemperatureset,
        airSpeed: checkData.airSpeed,
        airWinddirection: checkData.airWinddirection,
        runWeek: value.join(","),
        isPause: checkData.isPause?1:0,
        beanName: 'probeTimeTask',
      };
      ajax.post({
        url: this.$API.modifJob + checkData.id,
        data: po_obj,
        success: (response) => {
          this.$message({
            message: response.message,
            type: "success",
          });
        },
        error: (res) => {
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    // 修改时间
    timeValue(value) {
      console.log(value);
      let date = new Date();
      let y = date.getFullYear();
      let m = date.getMonth() + 1;
      let d = date.getDate();
      let timeStr = y + "-" + m + "-" + d + " " + value + ":" + "00";
      let fdate = new Date(timeStr);
      return fdate;
    },
    timeChange(rowData) {
      this.editTime = rowData.runTime;
    },
    //
    handleEditOperation(row){
   
      this.isadd=false
      this.pojoOperation= [{...row}].map(({...rest }) => ({
              ...rest,
              airMode : parseInt(rest.airMode),
              airSpeed : parseInt(rest.airSpeed),
              airWinddirection : parseInt(rest.airWinddirection),
              runWeek:rest.runWeek != ""? rest.runWeek.split(",").map(parseFloat): []

          }))[0];
             this.dialogOperationVisible = true;
    },
    EditOperationSubmit(fromName) {
      this.$refs[fromName].validate((valid) => {
        if (valid) {
          let pojodata = this.pojoOperation;
          pojodata.runWeek = pojodata.runWeek.join(",");
          pojodata.organId = this.organId
          ajax.post({
             url: this.$API.modifJob + this.pojoOperation.id,
            data: pojodata,
            success: (response) => {
              if (response.success) {
                this.getStrategyOperationData();
                this.dialogOperationVisible = false;
                this.$message({
                  message: response.message,
                  type: "success",
                });
              }
            },
            error: (response) => {
              this.$message({
                message: response.message,
                type: "error",
              });
            },
          });
        }
      });
    },
    // 修改操作
    operationChange(rowData, e) {
      // console.log(rowData, e)
      if (e && e.type == "blur" && this.editTime == rowData.runTime) {
        return;
      }
      let po_obj = {
        id: rowData.id,
        runTime: rowData.runTime,
        runWeek: rowData.runWeekstr.join(","),
        onOff: rowData.onOff,
        airMode: rowData.airMode,
        airTemperatureset: rowData.airTemperatureset,
        airSpeed: rowData.airSpeed,
        airWinddirection: rowData.airWinddirection,
        isPause: rowData.isPause?1:0,
        beanName: 'probeTimeTask',
      };


      ajax.post({
        url: this.$API.modifJob + rowData.id,
        data: po_obj,
        success: (response) => {
          this.getStrategyOperationData();
          this.$message({
            message: response.message,
            type: "success",
          });
          this.editTime = null;
        },
        error: (res) => {
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    // 修改操作
    operationChangeIsPause(rowData, e) {
      // console.log(rowData, e)
      if (e && e.type == "blur" && this.editTime == rowData.runTime) {
        return;
      }
      let po_obj = {
        jobId: parseInt(rowData.id),

        isPause: rowData.isPause ? 1: 0,

      };


      ajax.post({
        url: this.$API.updateJobIsPause,
        data: po_obj,
        success: (response) => {
          this.getStrategyOperationData();
          this.$message({
            message: response.message,
            type: "success",
          });
          this.editTime = null;
        },
        error: (res) => {
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },


    // 网点下的控制策略
    changeJobByOrgan() {
      
      if (this.changeJobByOrganId==1) {
        this.$confirm('确定所有策略都启用?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data={}
          data.id=this.organId
          data.probeTask=this.changeJobByOrganId
          ajax.post({
            url: this.$API.upDataOrgan  + this.organId,
            data:data,
            success: (response) => {
            this.organOptions[this.OrganIdindex].probeTask =this.changeJobByOrganId
              this.$message({
                type: 'success',
                message: '操作成功!'
              });
            },
            error: (res) => {
              this.$message({
                message: res.message,
                type: "error",
              });
            },
          });

        }).catch(() => {
          this.changeJobByOrganId = 0
        });
      }
      else {
        this.$confirm('确定所有策略都停用?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data={}
          data.id=this.organId
          data.probeTask=this.changeJobByOrganId
          ajax.post({
            url: this.$API.upDataOrgan +this.organId,
            data:data,
            success: (response) => {
              this.organOptions[this.OrganIdindex].probeTask =this.changeJobByOrganId
              this.$message({
                type: 'success',
                message: '操作成功!'
              });
            },
            error: (res) => {
              this.$message({
                message: res.message,
                type: "error",
              });
            },
          });


        }).catch(() => {
          this.changeJobByOrganId = 1
        });
      }
    },
    // table每行加上index
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },

    // 添加控制策略包含的操作
    handleAddOperation() {
      this.isadd=true
      this.dialogOperationVisible = true;
      
    },

    handleTemperatureChange(changeType) {
      let temperatureNumber = parseInt(this.pojoOperation.airTemperatureset);
      if (changeType == "add") {
        temperatureNumber = temperatureNumber + 1;
      } else {
        temperatureNumber = temperatureNumber - 1;
      }
      // 判断温度范围
      if (temperatureNumber > 31) {
        this.$message({
          message: "温度已经达到最高",
          type: "warning",
        });
        return;
      } else if (temperatureNumber < 16) {
        this.$message({
          message: "温度已经达到最低",
          type: "warning",
        });
        return;
      }
      this.pojoOperation.airTemperatureset = temperatureNumber;
    },
    // 提交控制策略
    addOperationSubmit(fromName) {
      this.$refs[fromName].validate((valid) => {
        if (valid) {
          let pojodata = this.pojoOperation;
          pojodata.runWeek = pojodata.runWeek.join(",");
       
          pojodata.organId = this.organId
          ajax.post({
            url: this.$API.addJob,
            data: pojodata,
            success: (response) => {
              if (response.success) {
                this.getStrategyOperationData();
                this.dialogOperationVisible = false;
                this.$message({
                  message: response.message,
                  type: "success",
                });
              }
            },
            error: (response) => {
              this.$message({
                message: response.message,
                type: "error",
              });
            },
          });
        }
      });
    },

    // 移除控制策略包含的操作
    handleOperationChange(value) {
      console.log(value);
      this.muloperationSelection = value;
    },
    handleDeleteOperation(data) {
      deleteConfirm(this).then((res) => {
        if (res) {
          ajax.post({
            url: this.$API.deleteJob + data.id,
            success: (response) => {
              if (response.success) {
                this.getStrategyOperationData();
                this.$message({
                  type: "success",
                  message: response.message,
                });
              }
            },
            error: (res) => {
              this.$message({
                message: res.message,
                type: "error",
              });
            },
          });
        }
      });
    },
    //绑定操作
    handletargetBindJob(data) {
      this.jobId = data.id;
      this.targetBindJobVisible = true;
      ajax.get({
        url: this.$API.getGroupByJob + this.jobId,
        success: (response) => {
          const resp = response.data;
          this.JobTargetLis = []
          if (resp) {
            for (let item of resp) {
              this.JobTargetLis.push(item.id)
            }
          }
        },
        error: (res) => {
          this.$message({
            message: res.message,
            type: "error",
          });
        },
      });
    },
    submittargetBindJob(value, direction, movedKeys) {

      let self = this
      //添加
      if (direction == "right") {
        axios
          .post(
            this.$API.bindJobGroup + this.jobId,
            movedKeys
          )
          .then(function (res) {
            if (res.data.success) {
              self.$message({
                message: "绑定成功",
                type: "success",
              });
            }
          });
      }
      //移除
      else {
        axios
          .post(this.$API.removeGroupAndJob + this.jobId, movedKeys)
          .then(function (res) {
            if (res.data.success) {
              self.$message({
                message: "移除成功",
                type: "success",
              });
            }
          });
      }
    },
    // 获取分组
    getAreaAppliances() {
      ajax.get({
        url: this.$API.getGroupByOrganIdAndType + `${this.organId}/0`,
        success: (response) => {
          const resp = response.data;
          this.AllAreaAppliancesData = resp;
        },
      });
    },
    // 重置表单
    resetForm() {
      this.$refs["pojoForm"].resetFields();
    },
    resetOperaForm() {
      this.airOperationFlag = "2";

       this.pojoOperation={
        jobName: "",
        organId: null,
        runWeek: [],
        runTime: "",
        onOff: 0,
        airMode: 0,
        isPause: 1,
        beanName: 'probeTimeTask',
        airSpeed: 0,
        airWinddirection: 0,
        airTemperatureset: 26,
        description: "",
      }
 
    },
  },
};
</script>

<style lang="stylus" scoped>
>>> {
  .control-strategy-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.2rem;
    overflow: auto;

    .head-section {
      .table-head {
        /* margin-top 0.2rem */
        height: 0.43rem;
        line-height: 0.43rem;
        font-size: 0.16rem;
        font-weight: normal;
        float: left;
      }

      header {
        float: right;
      }
    }

    .table-section {
      position: absolute;
      top: 0.72rem;
      left: 0.2rem;
      right: 0.2rem;
      bottom: 0.2rem;
    }

    .content {
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      padding: 0.2rem;
      box-sizing: border-box;
      background: #202c5f;
      overflow: auto;

      .content-button {
        text-align: right;
      }

      .area-table-section {
        position: absolute;
        top: 0.66rem;
        left: 0.2rem;
        right: 0.2rem;
        bottom: 0.2rem;

        .el-select--mini {
          width: 60px;

          .el-input--suffix .el-input__inner {
            padding-right: 20px;
            padding-left: 10px;
          }
        }

        .air-table-item {
          margin-right: 0.1rem;
        }

        .tem-input {
          width: 40px;
          height: 28px;

          .el-input__inner {
            height: 100%;
            padding: 0;
            text-align: center;
          }
        }
      }

      .el-dialog__body {
        padding: 10px 20px 0;
      }
    }
  }

  .manage-page-aside .el-table__body tr {
    cursor: pointer;
  }

  .el-table--striped .el-table__body tr.el-table__row--striped.current-row td, .el-table__body tr.current-row > td {
    color: #fff;
    background-color: rgba(68, 199, 244, 0.2) !important;
  }

  .el-table__body-wrapper {
    overflow-y: auto !important;
  }

  .el-table .el-checkbox__label, .el-table .el-radio__label, .el-checkbox {
    color: #fff;
  }

  .el-button.is-round {
    padding: 3px 6px;
  }

  .temperature-txt {
    padding: 0 0.1rem;
    font-size: 0.16rem;
    color: #fff;
  }

  .disabled {
    opacity: 0.5;
    pointer-events: none;
  }

  .el-date-editor.el-input, .el-date-editor.el-input__inner {
    width: 90%;
  }

  >>> .same-dia {
    .el-form .el-form-item:last-child {
      margin-bottom: 0;
    }

    .el-dialog__footer {
      padding: 0 0.3rem 0.3rem;
    }
  }

  .section-head {
    position: relative;
    margin-bottom: 0.1rem;

    .head-title {
      position: absolute;
      bottom: 0;
      display: inline-block;
      float: left;
      font-size: 0.16rem;
      font-weight: normal;
    }

    .buttons {
      display: inline-block;
      float: right;
    }
  }

  /* 空调状态 */
  .aic-conditioner-section {
    .air-table-item {
      display: inline-block;
      width: 1.8rem;
      margin: 0.1rem 0;
      margin-right: 0.02rem;

      .el-select {
        padding: 0;
        width: 50%;
      }
    }
  }
}
>>>.shuttle-row .el-transfer-panel {
    background: none;
}
>>>.el-switch__label {
    color:#fff}
>>>.el-switch__label.is-active {
    color: #fff;
}
>>>.shuttle-row .el-transfer-panel__item.el-checkbox {
    color: #fff;
}
>>>.shuttle-row .el-transfer__button {
    display: block;
    margin: 0;
    width: 90px;
    margin-top: 10px;
}
</style>
